using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;

namespace WhySoSeries
{
    class TvCountdownSeriesLinksProvider : SeriesLinksProvider
    {
        private WebsiteFactory factory;

        public TvCountdownSeriesLinksProvider(WebsiteFactory factory)
            : base(factory.SiteUrl + "/js/shows.js")
        {
            this.factory = factory;
        }

        protected override List<string> GetSeriesLinksListTemplate(string content)
        {
            List<string> seriesNames = new List<string>();
            Regex regex = new Regex(@"\[""[^""]+"", \d+, ""([^""]+)""");
            foreach(Match m in regex.Matches(content))
                seriesNames.Add(factory.SiteUrl + "/s/" + m.Groups[1].Value);
            return seriesNames;
        }
    }
}